home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / lang / amigatalk.lha / system / SafeDos.st < prev    next >
Text File  |  2002-03-22  |  7KB  |  207 lines

  1. "----------------------------------------------------------------------"
  2. " SafeDOS Class implements some of the less intrusive AmigaDOS func-   "
  3. " tions into AmigaTalk.                                                "
  4. ""
  5. " WARNING:  You should know what you're doing to the Amiga OS before   "
  6. "           messing with this Class, or any other System Class!        "
  7. ""
  8. " Please read AmigaTalk:Help/ADos.guide for guidance on how to use the "
  9. " methods of this Class -- it's really getting hard to document each   "
  10. " AmigaTalk Class in two or more places!                               "
  11. " ---------------------------------------------------------------------"
  12.  
  13. Class SafeDOS :Object
  14. [
  15.    abortPacket: dosPacket onMsgPort: msgPort
  16.       <primitive 246 0 msgPort dosPacket>
  17. |
  18.    addBuffers: howMany toFileDevice: diskDrive     
  19.       ^ <primitive 246 1 diskDrive howMany>
  20. |
  21.    getCLIObject
  22.       ^ <primitive 246 2>
  23. |
  24.    compareDates: dateStamp1 and: dateStamp2
  25.       ^ <primitive 246 3 dateStamp1 dateStamp2>
  26. |
  27.    currentDir: fromBPTRLock
  28.       ^ <primitive 246 4 fromBPTRLock>
  29. |
  30.    dateToStr: dateTime
  31.       ^ <primitive 246 5 dateTime>
  32. |
  33.    delay: ticks
  34.       <primitive 246 6 ticks>
  35. |
  36.    endNotify: notifyRequest
  37.       <primitive 246 7 notifyRequest>
  38. |
  39.    errorReport: code type: t arg1: a1 fromDevicePort: msgPort
  40.       ^ <primitive 246 8 code t a1 msgPort>
  41. |
  42.    fault: header code: c into: aBuffer ofSize: length
  43.       ^ <primitive 246 9 c header aBuffer length>
  44. |
  45.    fGetC: fromBPTRFileHandle
  46.       ^ <primitive 246 10 fromBPTRFileHandle>
  47. |
  48.    fGets: fromBPTRFileHandle into: aBuffer ofSize: length using: flag
  49.       " If flag is 0, then a newline will be left on the end of the
  50.       * returned String, a value of 1 will replace the last newline
  51.       * with a value of 0.
  52.       "
  53.       ^ <primitive 246 11 fromBPTRFileHandle aBuffer length flag>
  54. |
  55.    findCliProc: numbered
  56.       ^ <primitive 246 12 numbered>
  57. |
  58.    findVar: varName ofType: type
  59.       ^ <primitive 246 13 varName type>
  60. |
  61.    fPutC: theChar to: bptrFileHandle
  62.       ^ <primitive 246 14 bptrFileHandle theChar>
  63. |
  64.    fPutS: aString to: bptrFileHandle
  65.       ^ <primitive 246 15 bptrFileHandle aString>
  66. |
  67.    getArgStr
  68.       ^ <primitive 246 16>
  69. |
  70.    getConsoleTask
  71.       ^ <primitive 246 17>
  72. |
  73.    getCurrentDirNameInto: aBuffer ofSize: length
  74.       ^ <primitive 246 18 aBuffer length>
  75. |
  76.    getDeviceProc: name auxDevProc: devProc
  77.       ^ <primitive 246 19 name devProc>
  78. |               
  79.    getFileSysTask
  80.       ^ <primitive 246 20>
  81. |
  82.    getProgramDir
  83.       ^ <primitive 246 21>
  84. |
  85.    getProgramNameInto: aBuffer ofSize: length
  86.       ^ <primitive 246 22 aBuffer length>
  87. |
  88.    getPromptInto: aBuffer ofSize: length
  89.       ^ <primitive 246 aBuffer length>
  90. |
  91.    getVarNamed: name into: aBuffer ofSize: size flags: flags
  92.       <primitive 246 24 name aBuffer size flags>
  93. |
  94.    getIoErr                  " Tested "
  95.       ^ <primitive 246 25>
  96. |         
  97.    isFileSystem: name
  98.       ^ <primitive 246 26 name>
  99. |
  100.    isInteractive: bptrFileHandle
  101.       ^ <primitive 246 27 bptrFileHandle>
  102. |               
  103.    matchEnd: anchorPath
  104.       <primitive 246 28 anchorPath>
  105. |
  106.    matchFirst: pattern fromAnchor: anchorPath
  107.       ^ <primitive 246 29 pattern anchorPath>
  108. |
  109.    matchNext: anchorPath
  110.       ^ <primitive 246 30 anchorPath>
  111. |
  112.    getMaxCli
  113.       ^ <primitive 246 31>
  114. |
  115.    getParentDirLock: fromBPTRLock
  116.       ^ <primitive 246 33 fromBPTRLock>
  117. |
  118.    getParentLockFromFH: fromBPTRFileHandle
  119.       ^ <primitive 246 33 fromBPTRFileHandle>
  120. |
  121.    getPathPart: pathAndFile               " Tested "           
  122.       " AmigaDOS implementation: "
  123.       ^ <primitive 246 34 pathAndFile>
  124. |
  125.    getRealPathPart: pathAndFile           " Tested "
  126.       " My (less non-sensical) implementation: "
  127.       ^ <primitive 246 56 pathAndFile>
  128. |
  129.    getFilePart: pathAndFile               " Tested " 
  130.       ^ <primitive 246 55 pathAndFile>               
  131. |
  132.    printFault: header code: c
  133.       ^ <primitive 246 35 c header>
  134. |
  135.    putStr: aString
  136.       ^ <primitive 246 36 aString>
  137. |               
  138.    read: bptrFileHandle into: aBuffer ofSize: length
  139.       ^ <primitive 246 37 bptrFileHandle aBuffer length>
  140. |
  141.    readArgs: template into: stringPointerArray auxRDArgs: rdArgs
  142.       ^ <primitive 246 38 template stringPointerArray rdArgs>
  143. |               
  144.    readItemInto: aBuffer ofSize: maxChars with: csourceInput
  145.       ^ <primitive 246 39 aBuffer maxChars csourceInput>
  146. |
  147.    readLinkInto: aBuffer ofSize: length onPort: msgPort using: bptrLock and: pathName
  148.       ^ <primitive 246 40 msgPort bptrLock pathName aBuffer length>
  149. |
  150.    areSameDevice: bptrLock1 and: bptrLock2
  151.       ^ <primitive 246 41 bptrLock1 bptrLock2>
  152. |
  153.    areSameLock: bptrLock1 and: bptrLock2
  154.       ^ <primitive 246 42 bptrLock1 bptrLock2>
  155. |               
  156.    setCommentFieldOf: fileOrDirName to: comment   " Tested "
  157.       ^ <primitive 246 43 fileOrDirName comment>
  158. |
  159.    setFileDateOf: fileOrDirName to: dateStampObject
  160.       ^ <primitive 246 44 fileOrDirName dateStampObject>
  161. |               
  162.    setIoErrTo: errorCode
  163.       ^ <primitive 246 45 errorCode>
  164. |
  165.    translateIoErrToString: errorCode
  166.       ^ <primitive 246 58 errorCode>
  167. |
  168.    setPromptTo: newPromptString
  169.       ^ <primitive 246 46 newPromptString>
  170. |
  171.    stringToProtectionMask: protectionString            " Tested with +HPRW-SAED "
  172.       " Change a more readable (& memorable) string of protection
  173.       * bit specifiers into a protection mask for
  174.       * 'setProtectionOf:to:' below.
  175.       *
  176.       * format is: '+HPSA-RWED' or '+RWED' or '-hpsa' or '-rwed'
  177.       * or '+rwed-hpsa'  The string is NOT case sensitive.
  178.       * every flag after a + gets set, every flag after a - 
  179.       * gets cleared.  All bit specifiers do NOT have to be present.
  180.       "
  181.       ^ <primitive 246 57 protectionString>               
  182. |
  183.    setProtectionOf: filename to: protectionMask    " Tested. "
  184.       ^ <primitive 246 47 filename protectionMask>
  185. |
  186.    splitName: name by: sep into: aBuffer ofSize: size at: oldpos
  187.       ^ <primitive 246 48 name sep aBuffer oldpos size>
  188. |               
  189.    strToDate: dateTimeObject
  190.       ^ <primitive 246 49 dateTimeObject>
  191. |               
  192.    strToLong: aString
  193.       ^ <primitive 246 50 aString>
  194. |
  195.    unGetC: chr to: bptrFileHandle
  196.       ^ <primitive 246 51 bptrFileHandle chr>
  197. |
  198.    vFPrintfTo: bptrFileHandle format: fmtString withArgs: argv
  199.       ^ <primitive 246 52 bptrFileHandle fmtString argv>
  200. |
  201.    vPrintf: formatString withArgs: argv
  202.       ^ <primitive 246 53 formatString argv>
  203. |
  204.    waitForCharAt: bptrFileHandle for: timeout
  205.       ^ <primitive 246 54 bptrFileHandle timeout>
  206.